StrCompare

Note: This statement is named String Compare in the Add Statement dialog box.

Returns an integer to indicate if two strings match or the string sorted first based on alphabetical order comparison. The comparison uses the test computer's cultural settings for culture-specific sorting information, such as casing rules and the order of individual characters.

Syntax

StrCompare("FirstString", "SecondString", IsCaseSensitive)

Arguments

Argument Description
FirstString First string.
SecondString Second string.
IsCaseSensitive Case sensitive comparison. True matches the string case. False ignores the case. If not specified, True is used.

Return value

Value Description
Negative number First string is before second string in sorted order.
0 Strings match.
Positive number First string is after second string in sorted order.

Example

productA = "WysiDraw"

productB = "WysiWrite"

comp = StrCompare(productA, productB, False) 'Returns -1

comp = StrCompare(productB, productA, False) 'Returns 1